﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace IA2NeuralNetwork.CharMap
{
    public class NeuralNetworkCharMap
    {
        private static NeuralNetworkCharMap _Instance;
        public static NeuralNetworkCharMap Instance
        {
            get
            {
                if (NeuralNetworkCharMap._Instance == null)
                {
                    NeuralNetworkCharMap._Instance = new NeuralNetworkCharMap();
                }

                return NeuralNetworkCharMap._Instance;
            }
        }

        private List<CharByte> _BytesMap;
        public List<CharByte> BytesMap
        {
            get
            {
                return this._BytesMap;
            }
        }

        private List<CharLabel> _LabelMap;
        public List<CharLabel> LabelMap
        {
            get
            {
                return this._LabelMap;
            }
        }

        private List<CharRaw> _RawMap;
        public List<CharRaw> RawMap
        {
            get
            {
                return _RawMap;
            }
        }

        public NeuralNetworkCharMap()
        {
            this._BytesMap = new List<CharByte>();
            this._LabelMap = new List<CharLabel>();
            this._RawMap = new List<CharRaw>();

            this.PopulateBytesMap();
            this.PopulateLabelMap();
            this.PopulateRawMap();
        }

        private void PopulateBytesMap()
        {
            this._BytesMap.Add(new CharByte(new byte[] { 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1 }));
            this._BytesMap.Add(new CharByte(new byte[] { 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1 }));
            this._BytesMap.Add(new CharByte(new byte[] { 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1 }));
            this._BytesMap.Add(new CharByte(new byte[] { 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1 }));
            this._BytesMap.Add(new CharByte(new byte[] { 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1 }));
            this._BytesMap.Add(new CharByte(new byte[] { 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 }));
            this._BytesMap.Add(new CharByte(new byte[] { 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1 }));
            this._BytesMap.Add(new CharByte(new byte[] { 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1 }));
            this._BytesMap.Add(new CharByte(new byte[] { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1 }));
            this._BytesMap.Add(new CharByte(new byte[] { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1 }));
            this._BytesMap.Add(new CharByte(new byte[] { 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0 }));
            this._BytesMap.Add(new CharByte(new byte[] { 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1 }));
            this._BytesMap.Add(new CharByte(new byte[] { 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1 }));
            this._BytesMap.Add(new CharByte(new byte[] { 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1 }));
            this._BytesMap.Add(new CharByte(new byte[] { 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1 }));
            this._BytesMap.Add(new CharByte(new byte[] { 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 }));
            this._BytesMap.Add(new CharByte(new byte[] { 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0 }));
            this._BytesMap.Add(new CharByte(new byte[] { 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0 }));
            this._BytesMap.Add(new CharByte(new byte[] { 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1 }));
            this._BytesMap.Add(new CharByte(new byte[] { 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0 }));
            this._BytesMap.Add(new CharByte(new byte[] { 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1 }));
            this._BytesMap.Add(new CharByte(new byte[] { 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 0 }));
            this._BytesMap.Add(new CharByte(new byte[] { 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1 }));
            this._BytesMap.Add(new CharByte(new byte[] { 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1 }));
            this._BytesMap.Add(new CharByte(new byte[] { 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0 }));
            this._BytesMap.Add(new CharByte(new byte[] { 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1 }));

            this._BytesMap.Add(new CharByte(new byte[] { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1 }));
            this._BytesMap.Add(new CharByte(new byte[] { 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1 }));
            this._BytesMap.Add(new CharByte(new byte[] { 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1 }));
            this._BytesMap.Add(new CharByte(new byte[] { 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1 }));
            this._BytesMap.Add(new CharByte(new byte[] { 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1 }));
            this._BytesMap.Add(new CharByte(new byte[] { 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1 }));
            this._BytesMap.Add(new CharByte(new byte[] { 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1 }));
            this._BytesMap.Add(new CharByte(new byte[] { 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1 }));
            this._BytesMap.Add(new CharByte(new byte[] { 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1 }));
            this._BytesMap.Add(new CharByte(new byte[] { 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1 }));
        }

        private void PopulateLabelMap()
        {
            this._LabelMap.Add(new CharLabel(new byte[] { 0, 0, 0, 0, 0, 0 }));
            this._LabelMap.Add(new CharLabel(new byte[] { 0, 0, 0, 0, 0, 1 }));
            this._LabelMap.Add(new CharLabel(new byte[] { 0, 0, 0, 0, 1, 0 }));
            this._LabelMap.Add(new CharLabel(new byte[] { 0, 0, 0, 0, 1, 1 }));
            this._LabelMap.Add(new CharLabel(new byte[] { 0, 0, 0, 1, 0, 0 }));
            this._LabelMap.Add(new CharLabel(new byte[] { 0, 0, 0, 1, 0, 1 }));
            this._LabelMap.Add(new CharLabel(new byte[] { 0, 0, 0, 1, 1, 0 }));
            this._LabelMap.Add(new CharLabel(new byte[] { 0, 0, 0, 1, 1, 1 }));
            this._LabelMap.Add(new CharLabel(new byte[] { 0, 0, 1, 0, 0, 0 }));
            this._LabelMap.Add(new CharLabel(new byte[] { 0, 0, 1, 0, 0, 1 }));
            this._LabelMap.Add(new CharLabel(new byte[] { 0, 0, 1, 0, 1, 0 }));
            this._LabelMap.Add(new CharLabel(new byte[] { 0, 0, 1, 0, 1, 1 }));
            this._LabelMap.Add(new CharLabel(new byte[] { 0, 0, 1, 1, 0, 0 }));
            this._LabelMap.Add(new CharLabel(new byte[] { 0, 0, 1, 1, 0, 1 }));
            this._LabelMap.Add(new CharLabel(new byte[] { 0, 0, 1, 1, 1, 0 }));
            this._LabelMap.Add(new CharLabel(new byte[] { 0, 0, 1, 1, 1, 1 }));
            this._LabelMap.Add(new CharLabel(new byte[] { 0, 1, 0, 0, 0, 0 }));
            this._LabelMap.Add(new CharLabel(new byte[] { 0, 1, 0, 0, 0, 1 }));
            this._LabelMap.Add(new CharLabel(new byte[] { 0, 1, 0, 0, 1, 0 }));
            this._LabelMap.Add(new CharLabel(new byte[] { 0, 1, 0, 0, 1, 1 }));
            this._LabelMap.Add(new CharLabel(new byte[] { 0, 1, 0, 1, 0, 0 }));
            this._LabelMap.Add(new CharLabel(new byte[] { 0, 1, 0, 1, 0, 1 }));
            this._LabelMap.Add(new CharLabel(new byte[] { 0, 1, 0, 1, 1, 0 }));
            this._LabelMap.Add(new CharLabel(new byte[] { 0, 1, 0, 1, 1, 1 }));
            this._LabelMap.Add(new CharLabel(new byte[] { 0, 1, 1, 0, 0, 0 }));
            this._LabelMap.Add(new CharLabel(new byte[] { 0, 1, 1, 0, 0, 1 }));
            this._LabelMap.Add(new CharLabel(new byte[] { 0, 1, 1, 0, 1, 0 }));
            this._LabelMap.Add(new CharLabel(new byte[] { 0, 1, 1, 0, 1, 1 }));
            this._LabelMap.Add(new CharLabel(new byte[] { 0, 1, 1, 1, 0, 0 }));
            this._LabelMap.Add(new CharLabel(new byte[] { 0, 1, 1, 1, 0, 1 }));
            this._LabelMap.Add(new CharLabel(new byte[] { 0, 1, 1, 1, 1, 0 }));
            this._LabelMap.Add(new CharLabel(new byte[] { 0, 1, 1, 1, 1, 1 }));
            this._LabelMap.Add(new CharLabel(new byte[] { 1, 0, 0, 0, 0, 0 }));
            this._LabelMap.Add(new CharLabel(new byte[] { 1, 0, 0, 0, 0, 1 }));
            this._LabelMap.Add(new CharLabel(new byte[] { 1, 0, 0, 0, 1, 0 }));
            this._LabelMap.Add(new CharLabel(new byte[] { 1, 0, 0, 0, 1, 1 }));
        }

        private void PopulateRawMap()
        {
            this._RawMap.Add(new CharRaw("A"));
            this._RawMap.Add(new CharRaw("B"));
            this._RawMap.Add(new CharRaw("C"));
            this._RawMap.Add(new CharRaw("D"));
            this._RawMap.Add(new CharRaw("E"));
            this._RawMap.Add(new CharRaw("F"));
            this._RawMap.Add(new CharRaw("G"));
            this._RawMap.Add(new CharRaw("H"));
            this._RawMap.Add(new CharRaw("I"));
            this._RawMap.Add(new CharRaw("J"));
            this._RawMap.Add(new CharRaw("K"));
            this._RawMap.Add(new CharRaw("L"));
            this._RawMap.Add(new CharRaw("M"));
            this._RawMap.Add(new CharRaw("N"));
            this._RawMap.Add(new CharRaw("O"));
            this._RawMap.Add(new CharRaw("P"));
            this._RawMap.Add(new CharRaw("Q"));
            this._RawMap.Add(new CharRaw("R"));
            this._RawMap.Add(new CharRaw("S"));
            this._RawMap.Add(new CharRaw("T"));
            this._RawMap.Add(new CharRaw("U"));
            this._RawMap.Add(new CharRaw("V"));
            this._RawMap.Add(new CharRaw("W"));
            this._RawMap.Add(new CharRaw("X"));
            this._RawMap.Add(new CharRaw("Y"));
            this._RawMap.Add(new CharRaw("Z"));
            this._RawMap.Add(new CharRaw("1"));
            this._RawMap.Add(new CharRaw("2"));
            this._RawMap.Add(new CharRaw("3"));
            this._RawMap.Add(new CharRaw("4"));
            this._RawMap.Add(new CharRaw("5"));
            this._RawMap.Add(new CharRaw("6"));
            this._RawMap.Add(new CharRaw("7"));
            this._RawMap.Add(new CharRaw("8"));
            this._RawMap.Add(new CharRaw("9"));
            this._RawMap.Add(new CharRaw("0"));
        }
    }
}
